#!/usr/bin/python2.7
import antlr3
from CLexer import CLexer
from CParser import CParser
#from CWalker import CWalker

path_to_input = './sample.c'
char_stream = antlr3.ANTLRFileStream(path_to_input)

lexer = CLexer(char_stream)
tokens = antlr3.CommonTokenStream(lexer)
parser = CParser(tokens)
root = parser.translation_unit()

def printTree( node, indent ):
	sindent = ''.join([ "\t" for i in range(indent) ])
	print ( sindent +  node.getText() )
	for i in node.getChildren():
		printTree ( i, indent+1 )

printTree( root.tree, 0 );

#nodes = antlr3.tree.CommonTreeNodeStream(root)
#nodes.setTokenStream(tokens)
#walker = CWalker(nodes)
#walker.entry_rule()
